﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DigDes.DSchool.SUPS.WebMVC.UI.Models;

namespace DigDes.DSchool.SUPS.WebMVC.UI.Controllers
{
    public class ReportController : Controller
    {
        //
        // GET: /Report/
        
        //сразу форма ддля поиска
        [HttpGet]
        public ViewResult Index()
        {
            return View();
        }

        [HttpPost]
        public ViewResult Index(RequestModel requestModel)
        {
            if (ModelState.IsValid)
            {
                string number = requestModel.InventoryNumber;
                IEnumerable<DigDes.DSchool.SUPS.DataAccess.Interface.ReportModelDTO> model = DigDes.DSchool.SUPS.DataAccess.Database.ReportDAC.GetReportByNumber(number);
                return View("Report", model);
            }
            else
            {
                return View();
            }
        }
    }
}
